package com.eatrip.service.implementation;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eatrip.bean.User;
import com.eatrip.dao.UserDAO;
import com.eatrip.service.UserService;

@Service
public class UserServiceImple implements UserService {
	
	@Autowired
	private UserDAO userDAO;
	
	@Transactional(readOnly=true)
	public User getUser(String username, String password){
		return userDAO.getUser(username, password);
	}
	
	@Transactional(readOnly=true)
	public User getUserByEmail(String email){
		return userDAO.getUserByEmail(email);
	}
	
	@Transactional(readOnly=true)
	public List<User> getAllUser(){
		return userDAO.getAllUser();
	}
	
	@Transactional(readOnly=false)
	public void insertUser(User user){
		userDAO.insertUser(user);
	}
	
	@Transactional(readOnly=false)
	public void deleteUser(User user){
		userDAO.deleteUser(user);
	}
	
	@Transactional(readOnly=false)
	public void deleteAllUser(){
		userDAO.deleteAllUser();
	}
}
